<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String ctx = request.getContextPath();
    request.setAttribute("ctx", ctx);
%>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.8.2.min.js"></script>
    <script src="js/fileupload.js"></script>
    <script src="My97DatePicker/WdatePicker.js"></script>
    <link rel="stylesheet" href="css/img.css">
</head>
<body>
<form action="list.do" method="post">
    <input type="hidden" name="cpage">
    收货单号:<input type="text" name="mohu1" value="${map.mohu1}">
    制单时间:<input type="text" name="zhidandate" value="${map.startTime}">~~
        <input type="text" name="zhidandate" value="${map.endTime}">

    收货日期:<input type="text" name="date" value="${map.startTime1}">~~
        <input type="text" name="date" value="${map.endTime1}">

    优先级:<input type="text" name="youxian" value="${map.startTime2}">~~
        <input type="text" name="youxian" value="${map.endTimd2}">

    客户:<input type="text" name="mohu2" value="${map.mohu2}">
    发货单列:<input type="text" name="mohu3" value="${map.mohu3}">
    制单人工号:<input type="text" name="mohu4" value="${map.mohu4}">
    备注:<input type="text" name="mohu5" value="${map.mohu5}">
    <input type="submit" value="查询">
</form>
<table border="1">
    <tr>
        <td>编号</td>
        <td>收货日期</td>
        <td>收货单号</td>
        <td>优先级</td>
        <td>状态</td>
        <td>备注</td>
        <td>客户</td>
        <td>客户发货单列</td>
        <td>制单人工号</td>
        <td>制单时间</td>
        <td>收货附件</td>
        <td>
            <input type="button" value="添加" onclick="toadd()">
        </td>
    </tr>
    <c:forEach items="${pageInfo.list}" var="h">
        <tr>
            <td>${h.hid}</td>
            <td>${h.date}</td>
            <td>${h.danhao}</td>
            <td>${h.youxian}</td>
            <td>${h.status}</td>
            <td>${h.beizhu}</td>
            <td>${h.mnames}</td>
            <td>${h.fhdanhao}</td>
            <td>${h.zdrgonghao}</td>
            <td>${h.zhidandate}</td>
            <td>
                <img src="${h.fujian}" alt="无法展示" width="100px">
            </td>
            <td>
                <input type="button" value="取消" onclick="del(${h.hid})">
            </td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="11">
            <input type="button" value="首页" onclick="fenye(1)">
            <input type="button" value="上一页" onclick="fenye(${pageInfo.isFirstPage?1:pageInfo.prePage})">
            <input type="button" value="下一页" onclick="fenye(${pageInfo.isLastPage?pageInfo.pages:pageInfo.nextPage})">
            <input type="button" value="尾页" onclick="fenye(${pageInfo.pages})">
        </td>
    </tr>
</table>
</body>
<script>
    function fenye(cpage) {
        $("[name='cpage']").val(cpage);
        $("form").submit();
    }
    function toadd() {
        location="toadd.do";
    }
    function del(hid) {
        $.ajax({
                   url:"del.do",
                   type:"post",
                   data:{"hid":hid},
                   dataType:"json",
                   success:function(obj) {
                       if (obj>0){
                           alert("取消成功");
                           location="list.do";
                       }
                   }
              })
    }
</script>
</html>
